package com.group3.pojo.receive;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.group3.domain.File;
import com.group3.domain.Leave;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * @ClassName LeaveDetailReceive
 * @Author WenhaoChen
 * @Date 2021/7/8 10:29
 **/
@Data
public class LeaveDetailReceive {
    private Integer leaveId;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    private Date startLeaveTime;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    private Date endLeaveTime;

    private Integer state;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    private Date submitTime;

    private Integer studentId;

    private String studentNo;

    private Integer type;

    private String theme;

    private String reason;

    @ApiModelProperty(name = "files", value = "上传文件（files:[{'fileUrl':'','fileName':''}],[{'fileUrl':'','fileName':''},{...}]）",
            dataType = "File")
    private List<File> files;

    public Leave getLeave(){
        Leave leave = new Leave();
        leave.setSubmitTime(submitTime);
        leave.setLeaveId(leaveId);
        leave.setStudentId(studentId);
        leave.setState(state);
        leave.setReason(reason);
        leave.setTheme(theme);
        leave.setStartLeaveTime(startLeaveTime);
        leave.setEndLeaveTime(endLeaveTime);
        leave.setType(type);

        return leave;
    }
}
